package com.superm.service.impl;

import com.superm.entity.Emp;
import com.superm.entity.ShelfApplication;
import com.superm.entity.ShelfComeout;
import com.superm.entity.ShelfComeoutPoJo;
import com.superm.mappers.ShelfComeoutMapper;
import com.superm.service.ShelfComeoutService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service

public class ShelfComoutServiceImpl implements ShelfComeoutService {

    @Autowired
    private ShelfComeoutMapper shelfComeoutMp;

    /**
     * 实现模糊查询上架出库单信息
     * @param shelfComeoutPoJo
     * @param pageNo
     * @param pageSize
     * @return
     */
    @Override
    public Map<String,Object> likeShelfComout(ShelfComeoutPoJo shelfComeoutPoJo, Integer pageNo, Integer pageSize) {
        Map<String,Object> map = new HashMap<String,Object>();
        map.put("code",0);
        map.put("success",true);
        //替换值
        ShelfComeout shelfComeout = new ShelfComeout();
        BeanUtils.copyProperties(shelfComeoutPoJo,shelfComeout);
        //编号替换
        shelfComeout.setShelfApplication(new ShelfApplication(shelfComeoutPoJo.getShelfApplication()));
        //经办人替换
        shelfComeout.setEmpId(new Emp(shelfComeoutPoJo.getEName()));
        //模糊查询上架出库单
        map.put("data",shelfComeoutMp.likeMationInfo(shelfComeout,(pageNo-1)*pageSize,pageSize));
        //查询条数
        map.put("count",shelfComeoutMp.selectCount(shelfComeout));
        return map;
    }
}
